import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class Completed extends StatefulWidget {
  @override
  CompletedState createState() => new CompletedState();
}

void main(){
  runApp(MaterialApp(home: Completed(),routes: {},));
}
bool HaveTx = false;
String ImgUrl = '';
class CompletedState extends State<Completed> {
  bool HaveTX = false;
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
            backgroundColor: Color.fromRGBO(51, 51, 51, 1),
            titleSpacing: 0.0,
            title:Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children:<Widget> [
                FlatButton(
                  materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
                  child: Row(
                    children:<Widget> [
                      Icon(Icons.arrow_back_ios,color: Colors.white,),
                      Text('返回',style: TextStyle(color: Colors.white,fontSize: 16),)
                    ],
                  ),
                  onPressed: (){
                  },
                ),
                Container(child: Row(children: [
                  Text('抢单待确认详情',style: TextStyle(fontSize: 16,color: Colors.white,),),
                  SizedBox(width: 25,)
                ],),),
                IconButton(icon: Icon(Icons.more_horiz),color: Colors.white, onPressed: (){})
              ],
            )
        ),
        body:Column(
          children: <Widget>[
            Container(
              color:Colors.white,
              child: Column(
                children: <Widget>[
                  Container(

                    margin:EdgeInsets.only(left: 20,right: 20,top: 10,),
                    color: Colors.white,
                    child: Column(
                      children:<Widget> [
                        Column(
                          children: <Widget>[
                            Row(
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
                              children: <Widget>[
                                Text("跑腿",
                                  style: TextStyle(fontSize: 10),),
                                Text("已完成",
                                  style: TextStyle(fontSize: 15,color: Colors.red),),
                              ],
                            ),
                            SizedBox(
                              height: 10,
                            ),
                            Column(
                              crossAxisAlignment: CrossAxisAlignment.start,
                              children:<Widget> [
                                Text("任务主题（限制20字）",
                                  style: TextStyle(fontSize: 20),),
                                SizedBox(height: 10,),
                                Container(
                                  child: Row(
                                    mainAxisAlignment: MainAxisAlignment.start,
                                    children: <Widget>[
                                      Container(
                                        child: Row(
                                          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                                          children: <Widget>[
                                            Container(
                                              decoration: BoxDecoration(
                                                border: Border.all(width: 1,color: Colors.grey),
                                                borderRadius: BorderRadius.circular(75),
                                              ),
                                              width: 40,
                                              height: 40,
                                              child: Tx(),
                                            ),//头像
                                            SizedBox(
                                              width: 10,
                                            ),
                                            Column(
                                              crossAxisAlignment: CrossAxisAlignment.start,
                                              children: <Widget>[
                                                Text("发单人姓名"),
                                                Text("学校"),
                                              ],
                                            ),
                                          ],
                                        ),//头像,
                                      ),
                                    ],
                                  ),
                                ),
                              ],
                            ),
                          ],
                        ),//first
                        SizedBox(
                          height: 10,
                        ),
                        Divider(
                          color: Colors.grey,
                        ),
                        Column(
                          children: <Widget>[
                            Row(
                              mainAxisAlignment:MainAxisAlignment.start,
                              children:<Widget> [
                                Icon(Icons.attach_money,color: Colors.grey,),
                                SizedBox(
                                  width: 10,
                                ),
                                Text("跑腿费：4元",
                                  style: TextStyle(fontSize: 15,),),
                              ],
                            ),
                            SizedBox(
                              height: 10,
                            ),
                            Row(
                              mainAxisAlignment:MainAxisAlignment.start,
                              children: <Widget>[
                                Icon(Icons.access_time,color: Colors.grey,),
                                SizedBox(
                                  width: 10,
                                ),
                                Text("预计开始时间：2020/11/12  18:00"),
                              ],
                            ),
                            SizedBox(
                              height: 10,
                            ),
                            Row(
                              mainAxisAlignment:MainAxisAlignment.start,
                              children:<Widget> [
                                Container(
                                  margin: EdgeInsets.only(left: 33),
                                  child: Text("预计结束时间：2020/11/12  20:00"),
                                ),
                              ],
                            ),
                            Row(
                              mainAxisAlignment: MainAxisAlignment.start,
                              children: <Widget>[
                                Icon(Icons.email,color: Colors.grey,),
                                SizedBox(
                                  width: 10,
                                ),
                                Expanded(
                                  child: Padding(
                                    padding: EdgeInsets.only(top: 13,),
                                    child: Text("任务内容任务内容任务内容任务内容任务内容任务内容任务内容任务内容任务内容任务内容任务内容",
                                    ),
                                  ),
                                ),
                              ],
                            ),
                          ],
                        ),
                        SizedBox(
                          height: 10,
                        ),
                        Row(
                          mainAxisAlignment: MainAxisAlignment.start,
                          children: <Widget>[
                            Icon(Icons.location_on,color: Colors.grey,),
                            SizedBox(
                              width: 10,
                            ),
                            Text("福建省厦门市（发单人地址）",
                              style: TextStyle(fontSize: 15,),),
                          ],
                        ),
                        SizedBox(
                          height: 5,
                        ),
                        Divider(
                          color: Colors.grey,
                        ),
                        Column(
                          children:<Widget> [
                            Row(
                              children: <Widget>[
                                Icon(Icons.phone_android,color: Colors.grey,),
                                SizedBox(
                                  width: 10,
                                ),
                                Text("15688888888"),
                              ],
                            ),
                            SizedBox(
                              height: 20,
                            ),
                            Row(
                              mainAxisAlignment: MainAxisAlignment.center,
                              children: <Widget>[
                                Icon(Icons.phone,color: Colors.grey,),
                                SizedBox(
                                  width: 10,
                                ),
                                Text("电话发单人"),
                              ],
                            ),
                          ],
                        ),//third
                        SizedBox(
                          height: 5,
                        ),
                        Divider(color: Colors.grey,),
                        Row(
                          mainAxisAlignment:MainAxisAlignment.start,
                          children: <Widget>[
                            Icon(Icons.access_time,color: Colors.grey,),
                            SizedBox(
                              width: 10,
                            ),
                            Text("发单时间：2020/11/12  18:00"),
                          ],
                        ),
                        SizedBox(
                          height: 10,
                        ),
                        Row(
                          mainAxisAlignment:MainAxisAlignment.start,
                          children:<Widget> [
                            Container(
                              margin: EdgeInsets.only(left: 33),
                              child: Text("接单时间：2020/11/12  20:00"),
                            ),
                          ],
                        ),
                        SizedBox(
                          height: 10,
                        ),
                        Row(
                          mainAxisAlignment:MainAxisAlignment.start,
                          children:<Widget> [
                            Container(
                              margin: EdgeInsets.only(left: 33),
                              child: Text("完成时间：2020/11/12  20:10"),
                            ),
                          ],
                        ),
                        Divider(color: Colors.grey,),
                        Row(
                          mainAxisAlignment:MainAxisAlignment.start,
                          children: <Widget>[
                            Icon(Icons.location_on,color: Colors.grey,),
                            SizedBox(
                              width: 10,
                            ),
                            Text("接单人姓名"),
                            SizedBox(width: 30,),
                            Text("15688888888"),
                          ],
                        ),
                        Divider(color: Colors.grey,),
                        Row(
                          children: <Widget>[
                            Icon(Icons.attach_money,color: Colors.grey,),
                            SizedBox(
                              width: 10,
                            ),
                            Text("打赏金额：4元"),
                          ],
                        ),
                        SizedBox(
                          height: 10,
                        ),
                      ],
                    ),
                  ),
                ],
              ),
            ),


          ],
        ),
      ),
    );

  }
  @override
  void initState() {
    // TODO: implement initState
    super.initState();
  }

  @override
  void dispose() {
    // TODO: implement dispose
    super.dispose();
  }

  @override
  void didUpdateWidget(Completed oldWidget) {
    // TODO: implement didUpdateWidget
    super.didUpdateWidget(oldWidget);
  }

  @override
  void didChangeDependencies() {
    // TODO: implement didChangeDependencies
    super.didChangeDependencies();
  }
}
Tx() {
  if (HaveTx == false) {
    return Center(
      child: Text('头像',textAlign:TextAlign.center,),
    );
  } else {
    return Image.asset(
      ImgUrl,
      fit: BoxFit.fill,
    );
  }
}
